import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import Layout from './components/layout/Layout';
import Login from './pages/Login';
import AuthRoute from './components/AuthRoute';
import NotFound from './pages/NotFound';
// import 'antd/dist/antd.css';
import './theme/theme.less'; // 自定义个性配置

const App = () => {
  return (
    <ConfigProvider
      prefixCls="ant"
      space={{ size: 'middle' }}
    >
      <Router>
        <Routes>
          <Route path="/login" element={<Login />} /> 
          <Route path="/NotFound" element={<NotFound />} />
          <Route 
            path="/*" 
            element={
              <AuthRoute>
                <Layout />
              </AuthRoute>
            } 
          />
          <Route path="/" element={<Navigate to="/login" replace />} />
        </Routes>
      </Router>
    </ConfigProvider>
  );
};

export default App;
